package com.cefa.edu.controller;

import com.cefa.edu.common.result.Result;
import com.cefa.edu.common.result.ReturnMessage;
import com.cefa.edu.common.result.SuccessResult;
import com.cefa.edu.model.CefaEduSample;
import com.cefa.edu.service.SampleService;
import com.google.common.collect.Maps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by qimwang on 9/22/17.
 */
@RestController
public class SampleController {
    private Logger logger = LoggerFactory.getLogger(SampleController.class);

    @Autowired
    SampleService sampleService;


    @RequestMapping(path="/education/test", method = RequestMethod.POST)
    public Result<Map<String,Object>> dataUpload() {
        logger.warn("this is warning message");
        CefaEduSample sample = sampleService.getSample(1);

        Map<String, Object> result = Maps.newHashMap();
        result.put("name", sample);
        return new SuccessResult<>(new ReturnMessage("200", "success"), result);
    }
}
